/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package etherblocks.mods.survival.entitysystem.components;

import com.jme3.network.serializing.Serializable;

/**
 *
 * @author Philipp
 */
@Serializable
public class HealthComponent {
    private float health;
    private float maxHealth;
    private float regeneration;

    public HealthComponent() {
    }

    public HealthComponent(float health, float maxHealth, float regeneration) {
        if(health > maxHealth) {
            this.health = maxHealth;
        }
        else if(health < 0)
        {
            this.health = 0;
        }
        else
        {
            this.health = health;
        }
        this.maxHealth = maxHealth;
        this.regeneration = regeneration;
    }

    public float getHealth() {
        return health;
    }

    public float getMaxHealth() {
        return maxHealth;
    }

    public float getRegeneration() {
        return regeneration;
    }
    
    public float getHealthProportion()
    {
        return health / maxHealth;
    }
}
